home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / files / morefiles / cheaders / optimization.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  3.4 KB  |  97 lines

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    DirectoryCopy: #defines that let you make MoreFiles code more efficient.
  5. **
  6. **    by Jim Luther, Apple Developer Technical Support Emeritus
  7. **
  8. **    File:        Optimization.h
  9. **
  10. **    Copyright © 1992-1999 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. **
  21. **    The Optimization changes to MoreFiles source and header files, along with
  22. **    this file and OptimizationEnd.h, let you optimize the code produced
  23. **    by MoreFiles in several ways.
  24. **
  25. **    1 -- MoreFiles contains extra code so that many routines can run under
  26. **    Mac OS systems back to System 6. If your program requires a specific
  27. **    version of Mac OS and your program checks for that version before
  28. **    calling MoreFiles routines, then you can remove a lot of compatibility
  29. **    code by defining one of the following to 1:
  30. **
  31. **        __MACOSSEVENFIVEONEORLATER    // assume Mac OS 7.5.1 or later
  32. **        __MACOSSEVENFIVEORLATER        // assume Mac OS 7.5 or later
  33. **        __MACOSSEVENORLATER            // assume Mac OS 7.0 or later
  34. **
  35. **    If you're compiling 68K code, the default is to include all compatibility code.
  36. **    If you're compiling PowerPC code (TARGET_RT_MAC_CFM), the default is __MACOSSEVENORLATER
  37. **    If you're compiling for Carbon code (TARGET_API_MAC_CARBON), the default is __MACOSSEVENFIVEONEORLATER
  38. **
  39. **    2 -- You may disable Pascal calling conventions in all MoreFiles routines
  40. **    except for system callbacks that require Pascal calling conventions.
  41. **    This will make 68K C programs both smaller and faster. 
  42. **    (PowerPC compilers ignore pascal calling conventions.)
  43. **    Just define __WANTPASCALELIMINATION to be 1 to turn this optimization on
  44. **    when building MoreFiles for use from C programs (you'll need to keep
  45. **    Pascal calling conventions when linking MoreFiles routines with Pascal
  46. **    programs).
  47. **
  48. **    3 -- If Metrowerks compiler is used, "#pragma internal on" may help produce
  49. **    better code. However, this option can also cause problems if you're
  50. **    trying to build MoreFiles as a shared library, so it is by default not used.
  51. **    Just define __USEPRAGMAINTERNAL to be 1 to turn this optimization on.
  52. **
  53. **    Original changes supplied by Fabrizio Oddone
  54. **
  55. **    File:    Optimization.h
  56. */
  57.  
  58. #include <ConditionalMacros.h>
  59.  
  60. // if we're compiling for Carbon, then we're running on Mac OS 8.1 or later
  61. #ifndef __MACOSSEVENFIVEONEORLATER
  62.     #define __MACOSSEVENFIVEONEORLATER TARGET_API_MAC_CARBON
  63. #endif
  64.  
  65. #ifndef __MACOSSEVENFIVEORLATER
  66.     #define __MACOSSEVENFIVEORLATER __MACOSSEVENFIVEONEORLATER
  67. #endif
  68.  
  69. #ifndef __MACOSSEVENORLATER
  70.     #if TARGET_RT_MAC_CFM
  71.         #define __MACOSSEVENORLATER 1
  72.     #else
  73.         #define __MACOSSEVENORLATER __MACOSSEVENFIVEORLATER
  74.     #endif
  75. #endif
  76.  
  77.  
  78. #ifndef    __WANTPASCALELIMINATION
  79.     #define    __WANTPASCALELIMINATION    0
  80. #endif
  81.  
  82. #if    __WANTPASCALELIMINATION
  83.     #define pascal    
  84. #endif
  85.  
  86.  
  87. #ifndef __USEPRAGMAINTERNAL
  88.     #define    __USEPRAGMAINTERNAL    0
  89. #endif
  90.  
  91. #if    __USEPRAGMAINTERNAL
  92.     #if defined(__MWERKS__)
  93.         #pragma internal on
  94.     #endif
  95. #endif
  96.  
  97.